package cn.gson.springboot.model.pojos;

import javax.persistence.*;
import java.math.BigDecimal;
import java.sql.Date;
import java.util.Objects;

@Entity
@Table(name = "collectionrecord_", schema = "crm")
public class Collectionrecord {
    private int collectionrecordId;
    private Integer collectionrecordPeriods;
    private Date collectionrecordDate;
    private BigDecimal collectionrecordAmount;
    private Integer collectionrecordPaystyle;
    private Integer collectionrecordSort;
    private Integer collectionrecordInvoiced;
    private String collectionrecordNote;
    private String collectionrecordCustomerName;
    private String collectionrecordEmpName;
    private String collectionrecordReturnlist;
    private Contract contractByContractId;
    private Maintenance maintenanceByMaiId;
    private Employee employeeByEmpId;
    private Customer customerByCustomerId;
    private Planreceivable planreceivableByPlanreceivableId;
    private Integer collectionrecordBack;//回款退款判断

    @Id
    @Column(name = "collectionrecord_id", nullable = false)
    public int getCollectionrecordId() {
        return collectionrecordId;
    }

    public void setCollectionrecordId(int collectionrecordId) {
        this.collectionrecordId = collectionrecordId;
    }


    @Basic
    @Column(name = "collectionrecord_periods", nullable = true)
    public Integer getCollectionrecordPeriods() {
        return collectionrecordPeriods;
    }

    public void setCollectionrecordPeriods(Integer collectionrecordPeriods) {
        this.collectionrecordPeriods = collectionrecordPeriods;
    }

    @Basic
    @Column(name = "collectionrecord_date", nullable = true)
    public Date getCollectionrecordDate() {
        return collectionrecordDate;
    }

    public void setCollectionrecordDate(Date collectionrecordDate) {
        this.collectionrecordDate = collectionrecordDate;
    }

    @Basic
    @Column(name = "collectionrecord_amount", nullable = true, precision = 2)
    public BigDecimal getCollectionrecordAmount() {
        return collectionrecordAmount;
    }

    public void setCollectionrecordAmount(BigDecimal collectionrecordAmount) {
        this.collectionrecordAmount = collectionrecordAmount;
    }

    @Basic
    @Column(name = "collectionrecord_paystyle", nullable = true)
    public Integer getCollectionrecordPaystyle() {
        return collectionrecordPaystyle;
    }

    public void setCollectionrecordPaystyle(Integer collectionrecordPaystyle) {
        this.collectionrecordPaystyle = collectionrecordPaystyle;
    }

    @Basic
    @Column(name = "collectionrecord_sort", nullable = true)
    public Integer getCollectionrecordSort() {
        return collectionrecordSort;
    }

    public void setCollectionrecordSort(Integer collectionrecordSort) {
        this.collectionrecordSort = collectionrecordSort;
    }

    @Basic
    @Column(name = "collectionrecord_back", nullable = true)
    public Integer getCollectionrecordBack() {
        return collectionrecordBack;
    }

    public void setCollectionrecordBack(Integer collectionrecordBack) {
        this.collectionrecordBack = collectionrecordBack;
    }

    @Basic
    @Column(name = "collectionrecord_invoiced", nullable = true)
    public Integer getCollectionrecordInvoiced() {
        return collectionrecordInvoiced;
    }

    public void setCollectionrecordInvoiced(Integer collectionrecordInvoiced) {
        this.collectionrecordInvoiced = collectionrecordInvoiced;
    }

    @Basic
    @Column(name = "collectionrecord_note", nullable = true, length = 255)
    public String getCollectionrecordNote() {
        return collectionrecordNote;
    }

    public void setCollectionrecordNote(String collectionrecordNote) {
        this.collectionrecordNote = collectionrecordNote;
    }

    @Basic
    @Column(name = "collectionrecord_customer_name", nullable = true, length = 255)
    public String getCollectionrecordCustomerName() {
        return collectionrecordCustomerName;
    }

    public void setCollectionrecordCustomerName(String collectionrecordCustomerName) {
        this.collectionrecordCustomerName = collectionrecordCustomerName;
    }

    @Basic
    @Column(name = "collectionrecord_emp_name", nullable = true, length = 255)
    public String getCollectionrecordEmpName() {
        return collectionrecordEmpName;
    }

    public void setCollectionrecordEmpName(String collectionrecordEmpName) {
        this.collectionrecordEmpName = collectionrecordEmpName;
    }

    @Basic
    @Column(name = "collectionrecord_returnlist", nullable = true, length = 255)
    public String getCollectionrecordReturnlist() {
        return collectionrecordReturnlist;
    }

    public void setCollectionrecordReturnlist(String collectionrecordReturnlist) {
        this.collectionrecordReturnlist = collectionrecordReturnlist;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Collectionrecord that = (Collectionrecord) o;
        return collectionrecordId == that.collectionrecordId &&
                Objects.equals(collectionrecordPeriods, that.collectionrecordPeriods) &&
                Objects.equals(collectionrecordDate, that.collectionrecordDate) &&
                Objects.equals(collectionrecordAmount, that.collectionrecordAmount) &&
                Objects.equals(collectionrecordPaystyle, that.collectionrecordPaystyle) &&
                Objects.equals(collectionrecordSort, that.collectionrecordSort) &&
                Objects.equals(collectionrecordInvoiced, that.collectionrecordInvoiced) &&
                Objects.equals(collectionrecordNote, that.collectionrecordNote) &&
                Objects.equals(collectionrecordCustomerName, that.collectionrecordCustomerName) &&
                Objects.equals(collectionrecordEmpName, that.collectionrecordEmpName) &&
                Objects.equals(collectionrecordReturnlist, that.collectionrecordReturnlist);
    }

    @Override
    public int hashCode() {
        return Objects.hash(collectionrecordId, collectionrecordPeriods, collectionrecordDate, collectionrecordAmount, collectionrecordPaystyle, collectionrecordSort, collectionrecordInvoiced, collectionrecordNote, collectionrecordCustomerName, collectionrecordEmpName, collectionrecordReturnlist);
    }
    @ManyToOne
    @JoinColumn(name = "emp_id", referencedColumnName = "emp_id")
    public Employee getEmployeeByEmpId() {
        return employeeByEmpId;
    }

    public void setEmployeeByEmpId(Employee employeeByEmpId) {
        this.employeeByEmpId = employeeByEmpId;
    }

    @ManyToOne
    @JoinColumn(name = "customer_id", referencedColumnName = "customer_id")
    public Customer getCustomerByCustomerId() {
        return customerByCustomerId;
    }

    public void setCustomerByCustomerId(Customer customerByCustomerId) {
        this.customerByCustomerId = customerByCustomerId;
    }

    @ManyToOne
    @JoinColumn(name = "contract_id", referencedColumnName = "contract_id")
    public Contract getContractByContractId() {
        return contractByContractId;
    }

    public void setContractByContractId(Contract contractByContractId) {
        this.contractByContractId = contractByContractId;
    }

    @ManyToOne
    @JoinColumn(name = "mai_id", referencedColumnName = "mai_id")
    public Maintenance getMaintenanceByMaiId() {
        return maintenanceByMaiId;
    }

    public void setMaintenanceByMaiId(Maintenance maintenanceByMaiId) {
        this.maintenanceByMaiId = maintenanceByMaiId;
    }

    @ManyToOne
    @JoinColumn(name = "planreceivable_id", referencedColumnName = "planreceivable_id")
    public Planreceivable getPlanreceivableByPlanreceivableId() {
        return planreceivableByPlanreceivableId;
    }

    public void setPlanreceivableByPlanreceivableId(Planreceivable planreceivableByPlanreceivableId) {
        this.planreceivableByPlanreceivableId = planreceivableByPlanreceivableId;
    }
}
